package com.csun.cmny.provider.model.enums.phone;

import com.csun.cmny.provider.model.enums.device.DmcDeviceStatusEnum;

import java.util.Arrays;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-01-08 15:48
 * @Description: the enum dmc phone type enum.
 */
public enum DmcPhoneZoneTypeEnum {

    DynamicIspct(1, "动检"),

    InfraRed(2, "红外"),

    Urgent(3, "紧急"),

    CoalGas(4, "煤气"),

    Smog(5, "烟雾"),

    DoorMagnet(6, "门磁"),

    LeakWater(7, "漏水"),

    Remain(8, "停留"),

    General(9, "普通");

    Integer key;

    String value;

    DmcPhoneZoneTypeEnum(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * Gets key.
     *
     * @return
     */
    public Integer getKey() { return key; }

    /**
     * Gets value.
     *
     * @return
     */
    public String getValue() { return value; }

    /**
     * 获取key获取value
     *
     * @param key key
     *
     * @return value value
     */
    public static String getValue(Integer key) {
        for (DmcDeviceStatusEnum ele : DmcDeviceStatusEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele.getValue();
            }
        }
        return null;
    }

    /**
     * 根据key获取该对象
     *
     * @param key key
     *
     * @return this enum
     */
    public static DmcDeviceStatusEnum getEnum(String key) {
        for (DmcDeviceStatusEnum ele : DmcDeviceStatusEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele;
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<DmcDeviceStatusEnum> getList() {
        return Arrays.asList(DmcDeviceStatusEnum.values());
    }

}
